$(function(){	
	var today = new Date();
	var dd = today.getDate();
	var mm = today.getMonth()+1; //January is 0!
	var yyyy = today.getFullYear();

	if(dd<10) {
	    dd = '0'+dd
	} 

	if(mm<10) {
	    mm = '0'+mm
	} 
	var currentDate = yyyy + '/' + mm + '/' + dd;
	var countDownDate = new Date(currentDate+ " "+stock_time).getTime();
	
//	var now = new Date().getTime();
//	
//	if (now >= countDownDate) {
//		countDownDate = new Date(currentDate+ " "+"23:59:59").getTime();
//	}


	var x = setInterval(function() {

	  var now = new Date().getTime();

	  var distance = countDownDate - now;

	  
	  if (distance < 0) {
	    clearInterval(x);
	    document.getElementById("forward_countdown").innerHTML = "";
	  } else {
		  var days = Math.floor(distance / (1000 * 60 * 60 * 24));
		  var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
		  var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
		  var seconds = Math.floor((distance % (1000 * 60)) / 1000);
		  document.getElementById("forward_countdown").innerHTML = "あと" + hours + "h "+ minutes + "m " + seconds + "s " + "以内のご注文て 当日出荷いたします。";
	  }
	}, 1000);

});

//$(function(){
//	var countDownDate = new Date("Jan 5, 2019 15:37:25").getTime();
//
//	var x = setInterval(function() {
//
//	  var now = new Date().getTime();
//
//	  var distance = countDownDate - now;
//
//	  var days = Math.floor(distance / (1000 * 60 * 60 * 24));
//	  var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
//	  var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
//	  var seconds = Math.floor((distance % (1000 * 60)) / 1000);
//
//	  document.getElementById("forward_countdown").innerHTML = hours + "h "
//	  + minutes + "m " + seconds + "s ";
//
//	  if (distance < 0) {
//	    clearInterval(x);
//	    document.getElementById("forward_countdown").innerHTML = "EXPIRED";
//	  }
//	}, 1000);
//
//});

function gotoStockInquiry($goodsId) {
	location.href = "goods_stock_inquiry?goodsId=" + $goodsId;
	
}